package com.kajespero.model;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Key;
import com.kajespero.json.annotation.JSonKind;
import com.kajespero.json.annotation.JSonMapping;
import com.kajespero.vo.UserVO;
import com.kajespero.webapp.validator.annotation.Validator;
import com.kajespero.webapp.validator.impl.UserValidator;

@Validator(clazz=UserValidator.class)
@PersistenceCapable(identityType = IdentityType.APPLICATION, detachable = "true")
@JSonKind(name="users",mappedBy="UserBean")
public class UserBean extends IdentifierVOBean<Long> implements UserVO{
	
	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Key key;
	
	@Persistent
	@JSonMapping(targetClass = Long.class)
	private Long id;
	
	@JSonMapping()
	private String firstName;
	
	@JSonMapping()
	private String lastName;
	
	@JSonMapping(mappedBy="surName")
	private String surName;
	
	@JSonMapping()
	private String email;
	
	@JSonMapping()
	private String password;

	/**
	 * 
	 */
	private static final long serialVersionUID = 2093005652095322982L;

	@Override
	public Long getId() {
		return this.id;
	}

	@Override
	public String getFirstName() {
		return this.firstName;
	}

	@Override
	public String getLastName() {
		return this.lastName;
	}

	@Override
	public String getSurName() {
		return this.surName;
	}

	@Override
	public String getEmail() {
		return this.email;
	}

	@Override
	public String getPassword() {
		return this.password;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public void setSurName(String surName) {
		this.surName = surName;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public Key getKey() {
		return key;
	}

	public void setKey(Key key) {
		this.key = key;
	}
}
